<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<c:set value="${requestScope.response.data.pageInfoUtil }" var="pageInfoUtil"/>
<c:set value="${requestScope.response.data.list }" var="list"/>
<jsp:useBean class="com.zxq.lawenf.pojo.ACase" id="pojo"/>

<c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
	<!-- 拆分,按照-拆分,取最后一个 -->
	<c:set value="${fn:split(me.key, '-')}" var="keys"/>
	<c:choose>
		<c:when test="${fn:startsWith(me.key,'STATUS_DRAFT')}">
			<!-- 0:草稿 -->
			<c:set value="${keys[1] + ''}" var="STATUS_DRAFT"/>
		</c:when>
		<c:when test="${fn:startsWith(me.key,'STATUS_PUBLISHED')}">
			<!-- 1:已发布 -->
			<c:set value="${keys[1] + ''}" var="STATUS_PUBLISHED"/>
		</c:when>
		<c:when test="${fn:startsWith(me.key,'STATUS_AUDIT_DEPART')}">
			<!-- 2:审批通过 -->
			<c:set value="${keys[1] + ''}" var="STATUS_AUDIT_DEPART"/>
		</c:when>
		<c:when test="${fn:startsWith(me.key,'STATUS_AUDIT_BUREAU')}">
			<!-- 3:审批失败 -->
			<c:set value="${keys[1] + ''}" var="STATUS_AUDIT_BUREAU"/>
		</c:when>
		<c:when test="${fn:startsWith(me.key,'STATUS_AUDIT_FINISH')}">
			<!-- 3:审批失败 -->
			<c:set value="${keys[1] + ''}" var="STATUS_AUDIT_FINISH"/>
		</c:when>
	</c:choose>
</c:forEach>
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<title>案件列表 - 综合性执法系统</title>
		<%@ include file="/common/include/head_title.jsp"%>
		<script type="text/javascript" src="${rootPath }/common/resource/My97DatePicker/WdatePicker.js"></script>
	</head>
	<body>
		<%@ include file="/common/include/head_header.jsp"%>
		<!-- 网页的主体部分 -->
		<div class="container">
			<div class="row">
				<div class="col-md-11 col-sm-offset-1">
					<h2 class="sub-header">案件列表
					</h2>
					<h4>
					<c:choose>
						<c:when test="${requestScope.operType == 'self' }">我发起的</c:when>
						<c:when test="${requestScope.operType == 'pending' }">待处理</c:when>
						<c:when test="${requestScope.operType == 'audit' }">待审核</c:when>
						<c:when test="${requestScope.operType == 'import' }">重大案件</c:when>
					</c:choose>
					</h4>
					<form action="${rootPath }/head/lawEnf/caseList.htm" method="post" class="form-inline">
						<input type="hidden" name="operType" value="${requestScope.operType }">
						<label for="status">状态:</label>
						<select name="status" class="form-control mr-sm-2">
							<option value="">请选择</option>
							<c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
								<c:if test="${fn:startsWith(me.key,'STATUS')}">
									<!-- 拆分,按照-拆分,取最后一个 -->
									<c:set value="${fn:split(me.key, '-')}" var="keys"/>
									<option value="${keys[1] }" ${requestScope.status == keys[1] ? 'selected' : '' }>${me.value}</option>
								</c:if>
							</c:forEach>
						</select>
						<label for="pubTime">发布时间:</label>
						<input type="text" name="st" value="" readonly="true" class="form-control mr-sm-2" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate"/>
						-->
						<input type="text" name="ed" value="" readonly="true" class="form-control mr-sm-2" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate"/>
						<input type="submit" class="btn btn-primary" value="搜索">
						<a href="${rootPath }/head/lawEnf/caseInsert.htm" class="btn btn-primary ml-2" target="_blank">添加</a>
					</form>
				</div>
				<div class="col-md-11 col-sm-offset-1">
					<div class="table-responsive mt-2">
						<table class="table table-striped table-hover">
							<thead>
								<tr>
									<th>序号</th>
									<th>创建人</th>
									<th title="局长审核">局审</th>
									<th title="部门审核">部审</th>
									<th>名称</th>
									<th title="类型">类型</th>
									<th title="状态">状态</th>
									<th>创建时间</th>
									<!-- <th>更新时间</th> -->
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${list }" var="listTemp" varStatus="stat">
									<tr>
										<td>${stat.count }</td>
										<td title="${listTemp.users.nickName }">
											${fn:substring(listTemp.users.nickName,0,subStrLen) }
										</td>
										<td title="${listTemp.dirUsers.nickName }">
											${fn:substring(listTemp.dirUsers.nickName,0,subStrLen) }
										</td>
										<td title="${listTemp.depUsers.nickName }">
											${fn:substring(listTemp.depUsers.nickName,0,subStrLen) }
										</td>
										<td title="${listTemp.name }">
											<a href="${rootPath}/head/lawEnf/caseUpdate.htm?id=${listTemp.id}" target="_blank">
												${fn:substring(listTemp.name,0,subStrLen) }
											</a>
										</td>
										<td>
											${listTemp.appTypeStr }
										</td>
										<td>
											${listTemp.statusStr }
										</td>
										<td>${listTemp.createTime }</td>
										<%-- <td>${listTemp.updateTime }</td> --%>
										<td>
											<c:if test="${listTemp.status ==  STATUS_DRAFT && sessionScope.users.id == listTemp.usersId}">
												<!-- 状态等于草稿,并且必须本人修改 -->
												<a href="${rootPath}/head/lawEnf/caseUpdate.htm?operType=draft&id=${listTemp.id}" target="_blank">
													修改
												</a>
											</c:if>
											<c:if test="${(listTemp.status ==  STATUS_PUBLISHED &&  sessionScope.users.position.code != 'enfPer' && sessionScope.users.id != listTemp.usersId)||
											 (listTemp.status ==  STATUS_AUDIT_DEPART && sessionScope.users.position.code == 'bureauLeader' && listTemp.appType == 1)
											 }">
												<!-- 
													审核满足三个条件
													部门领导审核(状态正确)
													局领导审核(重大案件才会审核)
													并且自己不能审核自己的
												 -->
												<a href="${rootPath}/head/lawEnf/caseUpdate.htm?operType=audit&id=${listTemp.id}" target="_blank">
													审核<br/>
												</a>
											</c:if>
											<c:if test="${ (listTemp.status ==  STATUS_AUDIT_DEPART || listTemp.status == STATUS_AUDIT_BUREAU) && sessionScope.users.position.code == 'bureauLeader'}">
												<a href="${rootPath}/head/lawEnf/caseUpdateSubmit.htm?operType=finish&id=${listTemp.id}" target="_blank">
													结案
												</a>
											</c:if>
											<a href="${rootPath}/head/lawEnf/historyList.htm?relaId=${listTemp.id}&hisType=1" target="_blank">
												操作历史
											</a>
										</td>
									</tr>
								</c:forEach>							
							</tbody>
						</table>
					</div>
				</div>
				<div class="col-md-11 col-sm-offset-1">
					<form id="pageForm" action="${rootPath }/head/lawEnf/caseList.htm"
						method="post" class="form-inline col-md-11 col-sm-offset-1">
						<!-- 设置一些参数 -->
						<input type="hidden" name="st" value="${requestScope.st }">
						<input type="hidden" name="ed" value="${requestScope.ed }">

						<input type="hidden" name="status" value="${requestScope.status }">
						<input type="hidden" name="operType" value="${requestScope.operType }">
	
						<nav aria-label="Page navigation example">
							<ul class="pagination justify-content-end">
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '1', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>首页</span>
									</a>
								</li>
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.prePage}', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>上一页</span>
									</a>
								</li>
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.nextPage}', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>下一页</span>
									</a>
								</li>
								<li class="page-item">
									<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.totalPage}', 'pageSize','${pageInfoUtil.pageSize}')">
										<span>尾页</span>
									</a>
								</li>
								<li class="page-item">共${pageInfoUtil.totalRecord }条,共${pageInfoUtil.totalPage}页</li>
								<li class="page-item">
									第<input type="text" id="currentPage" name="currentPage" class="form-control" value="${pageInfoUtil.currentPage }"  size="5" maxlength="5"/>页
								</li>
								<li class="page-item">
									<input type="text" id="pageSize" name="pageSize" class="form-control" value="${pageInfoUtil.pageSize }" size="5" maxlength="5"/>
								</li>
								<li class="page-item"><input type="submit" value="GO" class="form-control btn btn-primary"/></li>
							</ul>
						</nav>
					</form>
				</div>
			</div>
		</div>
		<%@ include file="/common/include/head_footer.jsp"%>
	</body>
</html>